There’s a known issue with the API when creating a schedule via the API. Currently, you need to wrap the user object in an envelope to get it to work, like so:
"users": [
{
"user": {
"id": "",
"type": "user"
}}
]
Example
curl -X POST -H "Authorization: Token token=YOUR-APIP-TOKEN" -H "Content-Type: application/json" -d '{
"schedule": {
"name": "Created via the API",
"type": "schedule",
"time_zone": "America/New_York",
"description": "Rotation schedule for engineering",
"schedule_layers": [
{
"name": "Night Shift",
"start": "2017-04-07T20:00:00-05:00",
"end": "2017-14-07T20:00:00-05:00",
"rotation_virtual_start": "2017-04-07T20:00:00-05:00",
"rotation_turn_length_seconds": 86400,
"users": [
{
"id": "PTUW18Z",
"type": "user"
}
],
"restrictions": [
{
"type": "daily_restriction",
"start_time_of_day": "08:00:00",
"duration_seconds": 32400
}
]
}
]
}
}' "https://api.pagerduty.com/incidents?time_zone=UTC"